﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using System.Windows;

namespace UIControls
{
    public class BaseDialogWindow:Window
    {
        public BaseDialogWindow()
            : base()
        {
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            Owner = System.Windows.Application.Current.MainWindow;
            ResizeMode = System.Windows.ResizeMode.NoResize;
            this.KeyUp += new System.Windows.Input.KeyEventHandler(BaseDialogWindow_KeyUp);
        }

        void BaseDialogWindow_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key == System.Windows.Input.Key.Escape)
            {
                this.Close();
            }
        }

        /// <summary>
        /// 输入框对空格的过滤
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void Input_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            
            //if (e.Key == Key.Space || e.Key == Key.OemPeriod || e.Key== Key.OemComma || e.Key == Key.D7 || e.Key == Key.OemQuotes )
            //{
            //    e.Handled = true;
            //    return;
            //}

        }
    }
}